<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.6.3/jquery.js"></script>
    <style>
        * {
            margin: 0;
            padding: 0;
        }

        .container {
            width: 500px;
            margin: 50px auto;
            display: flex;
            flex-wrap: wrap;
        }

        ul {
            width: 200px;
            border: 1px solid;
            list-style: none;
        }

        .pink>li {
            background-color: pink;
        }

        .skyblue>li {
            background-color: skyblue;
        }

        li {

            height: 50px;
            text-align: center;
            line-height: 50px;
            border: 1px solid;
        }
    </style>
</head>

<body>
    <div class="container">
        <ul class="pink">
            <li>item1</li>
            <li>item2</li>
            <li>item3</li>
            <li>item4</li>
            <li>item5</li>
        </ul>

        <ul class="skyblue"></ul>
        <div class="btn">
            <button>右下移</button>
            <button>右上移</button>
            <button>全右</button>
            <button>全左</button>
            <button>左上移</button>
            <button>左下移</button>
        </div>
    </div>

    <script>
        //右移
        $('.btn').on('click', 'button', function () {
            let text = $(this).html();
            switch (text) {
                case '右上移':
                    $('.pink li').first().prependTo($('.skyblue'))
                    break;
                case '右下移':
                    $('.pink li').first().appendTo($('.skyblue'))
                    break;
                case '全右':
                    $('.pink li').appendTo($('.skyblue'))
                    break;
                case '全左':
                    $('.skyblue li').appendTo($('.pink'))
                    break;
                case '左下移':
                    $('.pink').append($('.skyblue li:last'))
                    break;
                case '左上移':
                    $('.pink').prepend($('.skyblue li:last'))
                    break;
            }
        })





    </script>

</body>

</html>